using System.Windows.Forms;
using FireStarterModeller.UI;
using Habanero.Faces.Base;
using Habanero.Test;
using NUnit.Framework;


namespace FireStarterModeller.Test.UI
{
    [TestFixture]
    public class TestDirectorySelectorControl
    {
        [TestFixtureSetUp]
        public void SetupFixture()
        {
            UITestUtils.SetupFixture();
        }

        [SetUp]
        public virtual void SetupTest()
        {
            UITestUtils.SetupTest();
        }

        [Test]
        public void Test_Construction()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            DirectorySelectorControl directorySelectorControl = new DirectorySelectorControl();
            //---------------Test Result -----------------------
            Assert.AreEqual(1, directorySelectorControl.Controls.Count);
            Assert.IsInstanceOf(typeof(IPanel), directorySelectorControl.Controls[0]);
            IPanel panel = (IPanel) directorySelectorControl.Controls[0];
            Assert.AreEqual(2, panel.Controls.Count);
            Assert.IsInstanceOf(typeof(ITextBox), directorySelectorControl.FileSelectorTextBox);
            Assert.IsInstanceOf(typeof(IButton), directorySelectorControl.FileSelectorButton);

            Assert.AreEqual(directorySelectorControl.FileSelectorButton.Height, directorySelectorControl.FileSelectorTextBox.Height + 2);
        }

        [Test]
        public void Test_Button()
        {
            //---------------Set up test pack-------------------
            
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            DirectorySelectorControl directorySelectorControl = new DirectorySelectorControl();
            //---------------Test Result -----------------------
            IButton button = directorySelectorControl.FileSelectorButton;
            Assert.AreEqual(25, button.Width);
            Assert.AreEqual(22, button.Height);
            Assert.AreEqual("...", button.Text);
        }

        [Test]
        public void Test_SelectedFileName_ShouldAppearInTextBox()
        {
            //---------------Set up test pack-------------------
            DirectorySelectorControl directorySelectorControl = new DirectorySelectorControl();
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            string fileName = dialog.SelectedPath;
            //---------------Test Result -----------------------
            Assert.AreEqual(directorySelectorControl.FileSelectorTextBox.Text, fileName);
        }

        //[Test]
        //public void Test_OpenDialogProperties()
        //{
        //    //---------------Set up test pack-------------------
        //    //---------------Assert Precondition----------------
        //    //---------------Execute Test ----------------------
        //    FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
        //    //---------------Test Result -----------------------
        //    Assert.IsFalse(folderBrowserDialog.Multiselect);
        //    Assert.IsTrue(folderBrowserDialog.CheckFileExists);
        //    Assert.AreEqual("", folderBrowserDialog.Filter);
        //}

        // Can't test this.
        //[Test]
        //public void Test_FolderDialogPopulatesWithCurrentDirectory()
        //{
        //    //---------------Set up test pack-------------------
            
        //    //---------------Assert Precondition----------------

        //    //---------------Execute Test ----------------------

        //    //---------------Test Result -----------------------

        //}
    }

}